package cn.bx.bid;


import cn.bx.bid.entity.User;
import cn.bx.bid.service.UserService;
import org.junit.Assert;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class BidApplicationTests {

    @Autowired
    private UserService userService;
    @Test
    void contextLoads() {
    }
    @Test
    public void testLogin1(){
        User admin = userService.login("admin", "123456");
        //断言
        Assert.assertNotNull(admin);

    }
    @Test
    public void testLogin2(){
        User admin = userService.login("admin", "666666");
        //断言
        Assert.assertNull(admin);
    }
    /* @Test
     public void testLogin3(){
         User admin = userService.login("admin", "666666");
         //断言
         Assert.assertEquals(admin!=null,true);
     }*/
    //19个测试方法
    //@before 测试之前做的准备
    //@After 测试之后做的收尾
    @BeforeEach
    public void bofe(){
        System.out.println("测试开始------------------");
    }
    @AfterEach
    public void jieshu(){
        System.out.println("测试结束了-------------");
    }
}